package com.cxmx.escort.aspect.baseApi;

import io.grpc.stub.ClientCalls;

import static io.grpc.MethodDescriptor.generateFullMethodName;
import static io.grpc.stub.ClientCalls.blockingUnaryCall;
import static io.grpc.stub.ClientCalls.futureUnaryCall;
import static io.grpc.stub.ServerCalls.asyncUnaryCall;
import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall;

/**
 */
@javax.annotation.Generated(
    value = "by gRPC proto compiler (version 1.23.0)",
    comments = "Source: api.proto")
public final class ApiGrpc {

  private ApiGrpc() {}

  public static final String SERVICE_NAME = "Api.Api";

  // Static method descriptors that strictly reflect the proto.
  private static volatile io.grpc.MethodDescriptor<Request,
          Response> getExamineWineMethod;

  @io.grpc.stub.annotations.RpcMethod(
      fullMethodName = SERVICE_NAME + '/' + "examine_wine",
      requestType = Request.class,
      responseType = Response.class,
      methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
  public static io.grpc.MethodDescriptor<Request,
          Response> getExamineWineMethod() {
    io.grpc.MethodDescriptor<Request, Response> getExamineWineMethod;
    if ((getExamineWineMethod = ApiGrpc.getExamineWineMethod) == null) {
      synchronized (ApiGrpc.class) {
        if ((getExamineWineMethod = ApiGrpc.getExamineWineMethod) == null) {
          ApiGrpc.getExamineWineMethod = getExamineWineMethod =
              io.grpc.MethodDescriptor.<Request, Response>newBuilder()
              .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
              .setFullMethodName(generateFullMethodName(SERVICE_NAME, "examine_wine"))
              .setSampledToLocalTracing(true)
              .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
                  Request.getDefaultInstance()))
              .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
                  Response.getDefaultInstance()))
              .setSchemaDescriptor(new ApiMethodDescriptorSupplier("examine_wine"))
              .build();
        }
      }
    }
    return getExamineWineMethod;
  }

  /**
   * Creates a new async stub that supports all call types for the service
   */
  public static ApiStub newStub(io.grpc.Channel channel) {
    return new ApiStub(channel);
  }

  /**
   * Creates a new blocking-style stub that supports unary and streaming output calls on the service
   */
  public static ApiBlockingStub newBlockingStub(
      io.grpc.Channel channel) {
    return new ApiBlockingStub(channel);
  }

  /**
   * Creates a new ListenableFuture-style stub that supports unary calls on the service
   */
  public static ApiFutureStub newFutureStub(
      io.grpc.Channel channel) {
    return new ApiFutureStub(channel);
  }

  /**
   */
  public static abstract class ApiImplBase implements io.grpc.BindableService {

    /**
     */
    public void examineWine(Request request,
                            io.grpc.stub.StreamObserver<Response> responseObserver) {
      asyncUnimplementedUnaryCall(getExamineWineMethod(), responseObserver);
    }

    @Override public final io.grpc.ServerServiceDefinition bindService() {
      return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
          .addMethod(
            getExamineWineMethod(),
            asyncUnaryCall(
              new MethodHandlers<
                      Request,
                      Response>(
                  this, METHODID_EXAMINE_WINE)))
          .build();
    }
  }

  /**
   */
  public static final class ApiStub extends io.grpc.stub.AbstractStub<ApiStub> {
    private ApiStub(io.grpc.Channel channel) {
      super(channel);
    }

    private ApiStub(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

    @Override
    protected ApiStub build(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      return new ApiStub(channel, callOptions);
    }

    /**
     */
    public void examineWine(Request request,
                            io.grpc.stub.StreamObserver<Response> responseObserver) {
      ClientCalls.asyncUnaryCall(
          getChannel().newCall(getExamineWineMethod(), getCallOptions()), request, responseObserver);
    }
  }

  /**
   */
  public static final class ApiBlockingStub extends io.grpc.stub.AbstractStub<ApiBlockingStub> {
    private ApiBlockingStub(io.grpc.Channel channel) {
      super(channel);
    }

    private ApiBlockingStub(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

    @Override
    protected ApiBlockingStub build(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      return new ApiBlockingStub(channel, callOptions);
    }

    /**
     */
    public Response examineWine(Request request) {
      return blockingUnaryCall(
          getChannel(), getExamineWineMethod(), getCallOptions(), request);
    }
  }

  /**
   */
  public static final class ApiFutureStub extends io.grpc.stub.AbstractStub<ApiFutureStub> {
    private ApiFutureStub(io.grpc.Channel channel) {
      super(channel);
    }

    private ApiFutureStub(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

    @Override
    protected ApiFutureStub build(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      return new ApiFutureStub(channel, callOptions);
    }

    /**
     */
    public com.google.common.util.concurrent.ListenableFuture<Response> examineWine(
        Request request) {
      return futureUnaryCall(
          getChannel().newCall(getExamineWineMethod(), getCallOptions()), request);
    }
  }

  private static final int METHODID_EXAMINE_WINE = 0;

  private static final class MethodHandlers<Req, Resp> implements
      io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
      io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
      io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
      io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
    private final ApiImplBase serviceImpl;
    private final int methodId;

    MethodHandlers(ApiImplBase serviceImpl, int methodId) {
      this.serviceImpl = serviceImpl;
      this.methodId = methodId;
    }

    @Override
    @SuppressWarnings("unchecked")
    public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
      switch (methodId) {
        case METHODID_EXAMINE_WINE:
          serviceImpl.examineWine((Request) request,
              (io.grpc.stub.StreamObserver<Response>) responseObserver);
          break;
        default:
          throw new AssertionError();
      }
    }

    @Override
    @SuppressWarnings("unchecked")
    public io.grpc.stub.StreamObserver<Req> invoke(
        io.grpc.stub.StreamObserver<Resp> responseObserver) {
      switch (methodId) {
        default:
          throw new AssertionError();
      }
    }
  }

  private static abstract class ApiBaseDescriptorSupplier
      implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier {
    ApiBaseDescriptorSupplier() {}

    @Override
    public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() {
      return ApiOuterClass.getDescriptor();
    }

    @Override
    public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() {
      return getFileDescriptor().findServiceByName("Api");
    }
  }

  private static final class ApiFileDescriptorSupplier
      extends ApiBaseDescriptorSupplier {
    ApiFileDescriptorSupplier() {}
  }

  private static final class ApiMethodDescriptorSupplier
      extends ApiBaseDescriptorSupplier
      implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
    private final String methodName;

    ApiMethodDescriptorSupplier(String methodName) {
      this.methodName = methodName;
    }

    @Override
    public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() {
      return getServiceDescriptor().findMethodByName(methodName);
    }
  }

  private static volatile io.grpc.ServiceDescriptor serviceDescriptor;

  public static io.grpc.ServiceDescriptor getServiceDescriptor() {
    io.grpc.ServiceDescriptor result = serviceDescriptor;
    if (result == null) {
      synchronized (ApiGrpc.class) {
        result = serviceDescriptor;
        if (result == null) {
          serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
              .setSchemaDescriptor(new ApiFileDescriptorSupplier())
              .addMethod(getExamineWineMethod())
              .build();
        }
      }
    }
    return result;
  }
}
